namespace WhoCanHelpMe.Web.Controllers.Profile.Mappers
{
    #region Using Directives

    using AutoMapper;

    using Contracts;

    using Domain;

    using ViewModels;

    #endregion

    public class CreateProfileDetailsMapper : ICreateProfileDetailsMapper
    {
        public CreateProfileDetailsMapper()
        {
            Mapper.CreateMap<CreateProfileFormViewModel, CreateProfileDetails>();
            Mapper.CreateMap<Identity, CreateProfileDetails>();
        }

        public CreateProfileDetails MapFrom(
            CreateProfileFormViewModel createProfileFormViewModel,
            Identity identity)
        {
            var viewModel = Mapper.Map<CreateProfileFormViewModel, CreateProfileDetails>(createProfileFormViewModel);

            Mapper.Map(
                identity,
                viewModel);

            return viewModel;
        }
    }
}